package com.cdream.basic.thread.manage;

import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.net.URL;
import java.net.URLConnection;

/**
 * @author cdream
 * @date 2021/8/19
 */
public class MxBeanExample {
    public static void main(String[] args) throws InterruptedException, IOException {
        ThreadMXBean tmBean = ManagementFactory.getThreadMXBean();
        URL url = new URL("https://hudson.dev.java.net");
        URLConnection connection = url.openConnection();
        long currentThreadCpuTime = tmBean.getCurrentThreadCpuTime();
        System.out.println(currentThreadCpuTime);
    }
}
